#ifdef PC
    #include "stdio.h"
#endif

#include "plateConf.h"

void initPlateConf ( plateConf* pConf ){
    
    setAbsis (pConf, 0);
    setOrdinat (pConf, 0);
    setTargetTemp (pConf, 0);
    setActTemp (pConf, 0);
    setBgTemp (pConf, 0);
    setKp (pConf, 0);
    setKi (pConf, 0);
    setKd (pConf, 0);

}

void setAbsis ( plateConf *pConf, uint8_t x){
    (*pConf).pAbsis = x;
}

void setOrdinat ( plateConf*  pConf, uint8_t x){
    (*pConf).pOrdinat = x;
}

void setTargetTemp ( plateConf*  pConf, uint8_t x){
    (*pConf).targetTemp = x;
}

void setActTemp ( plateConf*  pConf, uint8_t x){
    (*pConf).actTemp = x;
}

void setBgTemp ( plateConf*  pConf, uint8_t x){
    (*pConf).bgTemp = x;
}

void setKp ( plateConf*  pConf, uint8_t x){
    (*pConf).Kp = x;
}

void setKi ( plateConf*  pConf, uint8_t x){
    (*pConf).Ki = x;
}

void setKd ( plateConf*  pConf, uint8_t x){
    (*pConf).Kd = x;
}

uint8_t getAbsis ( plateConf pConf ){
    return pConf.pAbsis;
}

uint8_t getOrdinat ( plateConf pConf ){
    return pConf.pOrdinat;
}

uint8_t getTargetTemp ( plateConf pConf ){
    return pConf.targetTemp;
}

uint8_t getActTemp ( plateConf pConf ){
    return pConf.actTemp;
}

uint8_t getBgTemp ( plateConf pConf ){
    return pConf.bgTemp;
}

uint8_t getKp ( plateConf pConf ){
    return pConf.Kp;
}

uint8_t getKi ( plateConf pConf ){
    return pConf.Ki;
}

uint8_t getKd ( plateConf pConf ){
    return pConf.Kd;
}

#ifdef PC
    void printPlateConf ( plateConf pConf ){
        printf("--- plateConfig ---\n");
        printf("   pAbsis   : %d\n", pConf.pAbsis);
        printf("   pOrdinat : %d\n", pConf.pOrdinat);
        printf("   tgtTemp  : %d\n", pConf.targetTemp);
        printf("   actTemp  : %d\n", pConf.actTemp);
        printf("   bgTemp   : %d\n", pConf.bgTemp);
        printf("   Kp       : %d\n", pConf.Kp);
        printf("   Ki       : %d\n", pConf.Ki);
        printf("   Kd       : %d\n", pConf.Kd);
    }



    int isPConfEqual ( plateConf pConf1, plateConf pConf2){
        int retVal = 1;
        
        if ( getAbsis( pConf1 ) != getAbsis( pConf2 )) {retVal = 0;}
        if ( getOrdinat( pConf1 ) != getOrdinat( pConf2 )) {retVal = 0;}
        if ( getTargetTemp( pConf1 ) != getTargetTemp( pConf2 )) {retVal = 0;}
        if ( getActTemp( pConf1 ) != getActTemp( pConf2 )) {retVal = 0;}
        if ( getBgTemp( pConf1 ) != getBgTemp( pConf2 )) {retVal = 0;}
        if ( getKp( pConf1 ) != getKp( pConf2 )) {retVal = 0;}
        if ( getKi( pConf1 ) != getKi( pConf2 )) {retVal = 0;}
        if ( getKd( pConf1 ) != getKd( pConf2 )) {retVal = 0;}
        
        return retVal;       
        
    }
    
#endif
